﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace RedMoon.Handler
{
    /// <summary>
    /// LoginHandle 的摘要说明
    /// </summary>
    public class LoginHandle : IHttpHandler,System.Web.SessionState.IReadOnlySessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            string username = context.Request.Form["LoginName"].ToString();
            string password = context.Request.Form["LoginPwd"].ToString();
            if ((username.Equals("admin") == true && password.Equals("admin888") == true))
            {
                context.Session["LoginSuccess"] = username;
                context.Response.Write("{\"state\":true}");
            }
            else
            {
                context.Response.Write("{\"state\":false}");
            }

            try
            {
                
            }
            catch (Exception)
            {
                context.Response.Write("{\"state\":\"没有传入相应的参数！\"}");
            }

            
            
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}